package cn.com.surker.sale.entity;

import cn.com.surker.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 销售合同表
 * </p>
 *
 * @author admin
 * @since 2024-06-18
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SaleContract extends BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 标识
	 */
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;

	/**
	 * 编号
	 */
	private String code;

	/**
	 * 合同名称
	 */
	@NotBlank(message = "请输入合同名称")
	private String name;

	/**
	 * 公司ID
	 */
	private Long orgId;

	/**
	 * 客户ID
	 */
	@NotNull(message = "请选择客户")
	private Long clientId;

	/**
	 * 性质(1:正式2:临时,3零星)
	 */
	@NotNull(message = "请选择合同类型")
	private Integer quality;

	/**
	 * 供应状态(2:已授权1:待授权3:终止)
	 */
	private Integer workStatus;

	/**
	 * 签订方量
	 */
	@NotNull(message = "请输入签订方量")
	private Double stere;

	/**
	 * 合同单价类型(0:信息价1:合同价)
	 */
	@NotNull(message = "请选择单价类型(信息价/合同价)")
	private Integer priceType;

	/**
	 * 追加方量
	 */
	private Double addStere;

	/**
	 * 总方量
	 */
	private Double sumStere;

	/**
	 * 销售人员
	 */
	@NotBlank(message = "请输入销售人员")
	private String sales;

	/**
	 * 供应性质(0：销售:1：内部代加工、2：外包代加工)
	 */
	private Integer workNature;

	/**
	 * 开票单位
	 */
	private String ticketOrigin;
	/**
	 * 定位途经点
	 */
	private String wayPoints;

	/**
	 * 施工单位
	 */
	private String build;

	/**
	 * 运距
	 */
	private Double distance;

	/**
	 * 结算地区
	 */
	private String billArea;

	/**
	 * 结算税率
	 */
	private Double rate;

	/**
	 * 结算日
	 */
	private Integer billDay;

	/**
	 * 是否限供(0：否1：是)
	 */
	private Integer isWork;

	/**
	 * 限供内容
	 */
	private Double workContent;

	/**
	 * 工长
	 */
//	@NotBlank(message = "请输入前场工长")
	private String foreman;

	/**
	 * 工地联系人
	 */
	private String linkMan;

	/**
	 * 是否甲供(0:否，1：是)
	 */
	private Integer isSupplied;

	/**
	 * 回款间隔周期
	 */
	private Integer paymentCycle;
	/**
	 * 技术要求
	 */
	private String technical;

	/**
	 * 结算类型(0:月结，1：先款后货，2：垫资)
	 */
	private Integer billType;

	/**
	 * 垫资类型(-1:不垫资0:垫资方量，1：垫资金额，2：垫资天数)
	 */
	private Integer advanceType;

	/**
	 * 垫资内容(方量、天数、金额等)
	 */
	private Double advanceContent;

	/**
	 * 垫资回款数量(需要几个月内把垫资结清)
	 */
	private Integer advanceMonth;

	/**
	 * 垫资回款比例
	 */
	private Double advanceRate;

	/**
	 * 付款条件
	 */
	private String terms;

	/**
	 * 结算验收人
	 */
	private String acceptance;

	/**
	 * 结算时间点
	 */
	private String billTime;

	/**
	 * 微信订单工地联系人
	 */
	private String buildMan;

	/**
	 * 是否开票
	 */
	private Integer isTicket;

	/**
	 * 合同类型1:商砼，2：砂浆，3：水稳层，4：全轻混凝土，5：预制件合同)
	 */
	@NotNull(message = "请选择合同类型")
	private Integer contractCategory;

	/**
	 * 工程类型(0:其他，1：地产类，2：厂房类，3：市政基础建设类)
	 */
	private Integer projectCategory;

	/**
	 * 是否隐藏(0：否1：是)
	 */
	private Integer isDisplay;

	/**
	 * 是否含税(0:不含税,1:含税)
	 */
	private Integer isPriceTax;

	/**
	 * 造价信息调整
	 */
	private Integer adjustPriceType;

	/**
	 * 造价浮动率
	 */
	private Double floatRate;

	/**
	 * 送货地址(地位信息)
	 */
	private String address;

	/**
	 * 工地经度
	 */
	private String lng;

	/**
	 * 工地纬度
	 */
	private String lat;

	/**
	 * 结算比例
	 */
	private Double billRate;

	/**
	 * 签订时间
	 */
	@NotBlank(message = "请选择签定时间")
	private String signDate;

	/**
	 * 介绍人
	 */
	private String sponsor;
	/**
	 * 施工员电话
	 */
	private String phone;

	/**
	 * 结算人员
	 */
	private String reckoner;

	/**
	 * 业务性质(0:暂无,1:A1)
	 */
	private Integer businessQuality;
	/**
	 * 单价组合类型(0:组合类型，1：固定类型)
	 */
	private Integer priceComposeType;

	/**
	 * 运输策略(0:路线最优,1：高速)
	 */
	private Integer strategy;

	/**
	 * gps定位地址
	 */
	private String gpsAddress;

	/**
	 * 违约内容
	 */
	private String conditions;

	/**
	 * 小票抬头单位
	 */
	private String receiptUnit;

	/**
	 * 是否打印(0:打印1：不打印)
	 */
	private Integer isPrint;

	/**
	 * erpid
	 */
	private Long erpid;

	/**
	 * 批次id;null值不用管,等于自身id时为主合同;不等于自身id时,为从id
	 */
	private Long batchId;


	public String initCode() {
		return "";
	}

	@TableField(exist = false)
	private Long clientErpId;

	@TableField(exist = false)
	private String invoiceIds;
	/**
	 * 合同ID拼接信息 关联合同查询使用
	 */
	@TableField(exist = false)
	private String conIds;

	/**
	 * 合同ID拼接信息 关联合同查询不等于
	 */
	@TableField(exist = false)
	private String notConIds;
	/**
	 * 查询条件
	 */
	@TableField(exist = false)
	private String searchVal;

	@Override
	public String toString() {
		return "SaleContract{" +
				"id=" + id +
				", code='" + code + '\'' +
				", name='" + name + '\'' +
				", orgId=" + orgId +
				", clientId=" + clientId +
				", quality=" + quality +
				", workStatus=" + workStatus +
				", stere=" + stere +
				", priceType=" + priceType +
				", addStere=" + addStere +
				", sumStere=" + sumStere +
				", sales='" + sales + '\'' +
				", workNature=" + workNature +
				", ticketOrigin='" + ticketOrigin + '\'' +
				", wayPoints='" + wayPoints + '\'' +
				", build='" + build + '\'' +
				", distance=" + distance +
				", billArea='" + billArea + '\'' +
				", rate=" + rate +
				", billDay=" + billDay +
				", isWork=" + isWork +
				", workContent=" + workContent +
				", foreman='" + foreman + '\'' +
				", linkMan='" + linkMan + '\'' +
				", isSupplied=" + isSupplied +
				", paymentCycle=" + paymentCycle +
				", technical='" + technical + '\'' +
				", billType=" + billType +
				", advanceType=" + advanceType +
				", advanceContent=" + advanceContent +
				", advanceMonth=" + advanceMonth +
				", advanceRate=" + advanceRate +
				", terms='" + terms + '\'' +
				", acceptance='" + acceptance + '\'' +
				", billTime='" + billTime + '\'' +
				", buildMan='" + buildMan + '\'' +
				", isTicket=" + isTicket +
				", contractCategory=" + contractCategory +
				", projectCategory=" + projectCategory +
				", isDisplay=" + isDisplay +
				", isPriceTax=" + isPriceTax +
				", adjustPriceType=" + adjustPriceType +
				", floatRate=" + floatRate +
				", address='" + address + '\'' +
				", lng='" + lng + '\'' +
				", lat='" + lat + '\'' +
				", billRate=" + billRate +
				", signDate='" + signDate + '\'' +
				", sponsor='" + sponsor + '\'' +
				", phone='" + phone + '\'' +
				", reckoner='" + reckoner + '\'' +
				", businessQuality=" + businessQuality +
				", priceComposeType=" + priceComposeType +
				", strategy=" + strategy +
				", gpsAddress='" + gpsAddress + '\'' +
				", conditions='" + conditions + '\'' +
				", receiptUnit='" + receiptUnit + '\'' +
				", isPrint=" + isPrint +
				", erpid=" + erpid +
				", batchId=" + batchId +
				", clientErpId=" + clientErpId +
				", invoiceIds='" + invoiceIds + '\'' +
				", conIds='" + conIds + '\'' +
				", notConIds='" + notConIds + '\'' +
				", searchVal='" + searchVal + '\'' +
				'}';
	}
}
